package com.ruoyi.system.api.factory;

import com.ruoyi.system.api.RemoteChanceService;
import com.ruoyi.system.api.RemoteChatAiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * 远程ai服务熔断
 *
 * @author ruoyi
 */
@Component
public class RemoteChatAiFallbackFactory implements FallbackFactory<RemoteChatAiService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteChatAiFallbackFactory.class);

    @Override
    public RemoteChatAiService create(Throwable throwable)
    {
        throwable.printStackTrace();
        log.error("远程ai服务熔断:{}", throwable.getMessage());
        return new RemoteChatAiService()
        {


            @Override
            public String call(String msg,String userId) {
                return null;
            }
        };
    }
}
